"use client";
import { useRouter } from "next/navigation";
import useUserStore from "../state/login_state";
import { useEffect } from "react";

export function ValidLogin() {
  const token = useUserStore.getState().token;
  const router = useRouter();

  useEffect(() => {
    // 如果token为空，则重定向到登录页
    if (token === "") {
      router.push("/login");
    }
  }, [token, router]);
}
